package com.sx.water.modules.Controller;

import com.sx.water.modules.sever.WaterLineService;
import com.sx.water.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: chz
 * @Date: 2019/1/11 11:42
 * @Describe:
 */
@RestController
@CrossOrigin
@RequestMapping(value = "/waterLine")
public class WaterLineController {

    @Autowired
    WaterLineService waterLineService;

    /**
     * 水库/河道
     *
     * @param time
     * @return
     */
    @CrossOrigin
    @RequestMapping("/getRsvrAndRiverInfo")
    public R getRsvrAndRiverInfo(String time) {

        return R.ok(waterLineService.getRsvrAndRiverInfo(time));
    }

    /**
     * 水库/河道 时间序列
     *
     * @param starTime yymmddHHmm
     * @param endTime  yymmddHHmm
     * @return
     */
    @CrossOrigin
    @RequestMapping("/getRsvrAndRiverByTime")
    public R getRsvrAndRiverByTime(String starTime, String endTime) {
        return R.ok().put("DS", waterLineService.selectWaterByTime(starTime, endTime));
    }

    /**
     * 水库/河道 站点 时间序列 水位图
     *
     * @param starTime yymmddHHmm
     * @param num      时间间隔
     * @return
     */
    @CrossOrigin
    @RequestMapping("/getRsvrAndRiverByTimeAndStation")
    public R getRsvrAndRiverByTimeAndStation(String stationId, String starTime, int num) {
        return R.ok().put("DS", waterLineService.selectWaterByTimeAndStation(stationId, starTime, num));
    }


}
